package io.renren.modules.app.controller.wechat;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;
import io.renren.modules.app.entity.GoodCouponEntity;
import io.renren.modules.app.service.GoodCouponService;

@RestController
@RequestMapping("/wechat/goodcoupon")
public class WechatGoogCoupon {
	
	@Autowired
	private GoodCouponService goodCouponService;

	/**
	 * 列表
	 */
	@RequestMapping("/list")
	public R list(@RequestParam Map<String, Object> params){
		//查询列表数据
        Query query = new Query(params);

		List<GoodCouponEntity> goodCouponList = goodCouponService.queryList(query);
		int total = goodCouponService.queryTotal(query);
		
		PageUtils pageUtil = new PageUtils(goodCouponList, total, query.getLimit(), query.getPage());
		
		return R.ok().put("goodcoupons", pageUtil);
	}
}
